package com.onlineMIS.ORM.entity.headQ.inventoryFlow;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.beans.factory.annotation.Autowired;

import com.onlineMIS.ORM.DAO.headQ.inventoryFlow.HeadQInventoryStockDAOImpl;
import com.onlineMIS.ORM.DAO.headQ.inventoryFlow.HeadQInventoryStoreDAOImpl;
import com.onlineMIS.ORM.entity.chainS.user.ChainStore;
import com.onlineMIS.ORM.entity.headQ.barcodeGentor.ProductBarcode;
import com.onlineMIS.common.Common_util;
import com.onlineMIS.common.ExcelTemplate;
import com.onlineMIS.common.loggerLocal;


public class HeadqInvenTraceInfoTemplate extends ExcelTemplate {
	
	
	private final int header_row1_ind = 2;

	private List<HeadqInvenTraceInfoVO> list = new ArrayList<HeadqInvenTraceInfoVO>();

	public HeadqInvenTraceInfoTemplate(List<HeadqInvenTraceInfoVO> list,String templateWorkbookPath) throws IOException {
		super(templateWorkbookPath);
		this.list = list;
	}
	
	
	public HSSFWorkbook process() {
		HSSFSheet sheet = templateWorkbook.getSheetAt(0);
		int totalDataRow = list.size();
		for (int i = 0; i < totalDataRow; i++){
			HeadqInvenTraceInfoVO item = list.get(i);
			Row row = sheet.createRow(header_row1_ind + i);
			row.createCell(0).setCellValue(item.getOrderId());
			row.createCell(1).setCellValue(item.getBarcode());
			row.createCell(2).setCellValue(item.getQuantity());
			row.createCell(3).setCellValue(item.getDescp());
			row.createCell(4).setCellValue(item.getActionCode());
			row.createCell(5).setCellValue(item.getStore());
			row.createCell(6).setCellValue(item.getDate());
					
		}
		return templateWorkbook;
	}
    
}
